<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vue图片切换</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div id="app">
      <div class="center">
        <h2 class="title">
          <img src="./images/logo.png" alt="" />黑马深圳创维校区
        </h2>
        <!-- 图片 -->
        <img :src="imgArr[index]" alt="" />
        <!-- 左箭头 -->
        <a href="#" class="left" @click="prev" v-if="index!=0">
          <img src="./images/prev.png" alt="" />
        </a>
        <!-- 右箭头 -->
        <a href="#" class="right" @click="next" v-if="index<imgArr.length-1">
          <img src="./images/next.png" alt="" />
        </a>
      </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
    <script src="script.js"></script>
  </body>
</html>
